package com.hy.usercenter.utils;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description http工具类
 *
 * @Author minsf
 * @Date 2023/2/19
 */
public class HttpUtils {

    public static HttpServletRequest getRequest() {
        return getAttributes()
                .getRequest();
    }

    private static ServletRequestAttributes getAttributes() {
        return ((ServletRequestAttributes) RequestContextHolder.currentRequestAttributes());
    }
}
